Public: Technology Reviews : Whitespace Model
This page last changed on Jul 29, 2006 by scytacki.
One part of the current design is to have a generic whitespace model that can work for any type of configuration file. The purpose of this model is to link the emf model of the configuration file with the text of the file itself. There are two ways to do this:
I'm going to try the first approach. So what are the elements of the model. Using the language of the MDA (model driven architecture), it is an instance mapping. Using "marks" to indicate how a model element should be represented in the text. The elements that need to mapped will be instances of instances of the ecore kernel.
Simple example file: property1=red property2=blue property3=green The model could be, a Single EClass that represents the whole file. And this eclass has three properties. In java this would have an interface like: interface SimpleExample{ String getProperty1(); String getProperty2(); String getProperty3(); } In emf this would be something like: SimpleExample : EClass property1 : EAttribute property2 : EAttribute property3 : EAttribute This is still just what is known as the "core" model. It defines the types of objects. So there would be one of these core models for each type of config file. A particular config file would map to an instance of this core model. So using the simple example above it would be more like: MyFile : SimpleExample red : property1 blue : property2 green : property3 MappingSo given a particular instance of a particular core model, we need to map that instance to a text file. Lets start with: EModelElementLocation EObject objRef Postion position Postion namePosition EObjectLocation -> EModelElementLocation EObject objRef Postion openElementPosition Postion attributesPosition Postion closeElementPosition EStructuralFeatureLocation -> EModelElementLocation EStructuralFeature feature EAttributeLocation -> EStructuralFeatureLocation Postion valuePosition Postion assignmentPosition This model doesn't yet deal with EReferences, or lists of attributes or references. Uses of Whitespace ModelWith this whitespace model and the text, and the emf model. What can you do?
How to combine this with the standard emf editors.Any change to the emf model elements needs to be reflected in the text file. Adding observers for this is straight forward in emf. The easiest events to handle would be value change events. In response to this type of event the text editor syntax can be used to replace the current value with the new value. This can be done using the the text document model behind the text editor. Demo Steps
Demo Research Questions
Demo Notes
Linkshttp://devresource.hp.com/drc/technical_white_papers/eclipeditor/index.jsp- example of making text editor for eclipse |
Document generated by Confluence on Jan 27, 2014 16:56 |